﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IDM.BF.TestService;
using IDM.Client;
using IDM.Utils;

namespace IDM.TestClient
{
    class Program
    {
        static void Main(string[] args)
        {   
            Logger.WriteInformation("Running 'SayHello' test");
            SayHello();

            Logger.WriteInformation("");
            Logger.WriteInformation("Running with call to invalid service");
            CallInvalid();

            Logger.WriteInformation("");
            Logger.WriteInformation("Running with call to exception throwing");
            CallExceptionThrow();

            Logger.WriteInformation("");
            Logger.WriteInformation("Running with call to service which require other service");
            CallOtherService();
            
            Console.ReadKey(true);
        }
        
        private static void SayHello()
        {
            IHelloWorldService helloWorldService = ServiceFactory.GetService<IHelloWorldService>();            
            Logger.WriteInformation(helloWorldService.SayHello("Matej"));
        }

        private static void CallInvalid()
        {
            IInvalidService invalidService = ServiceFactory.GetService<IInvalidService>();
            invalidService.InvalidFunction();
        }

        private static void CallExceptionThrow()
        {
            IExceptionThrowingService excpetionThrow = ServiceFactory.GetService<IExceptionThrowingService>();
            excpetionThrow.ThrowException();
        }

        private static void CallOtherService()
        {
            ICallOtherService callOther = ServiceFactory.GetService<ICallOtherService>();
            Logger.WriteInformation(callOther.CallOther());
        }
        

    }
}
